package Thread.Thread05;

import java.util.concurrent.Callable;

public class MyCallble implements Callable {
    private int n;

    public MyCallble(int n) {
        this.n = n;
    }

    //重写call方法
    @Override
    public String call() throws Exception {
        //描述线程的任务，返回线程执行返回后的结果
        int sum = 0;
        for (int i = 1;i<=n;i++){
            sum+=i;
        }
        return Thread.currentThread().getName()+"线程求出了1-"+n+"的和是"+sum;
    }

    //这个类实现callble接口

}
